# Copyright 2025 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Tests for the Android version of the RL Catch game.
load("@rules_kotlin//kotlin:android.bzl", "kt_android_local_test")
load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")

kt_kotlinc_options(
    name = "kt_kotlinc_options",
    jvm_target = "11",  # Need to override default 1.8.
    x_no_param_assertions = True,
)

kt_android_local_test(
    name = "GameLogicTest",
    srcs = ["GameLogicTest.kt"],
    kotlinc_opts = ":kt_kotlinc_options",
    deps = [
        "//java/com/google/androidenv/catch:GameLogic",
        "//java/com/google/androidenv/catch/sprite:Background",
        "//java/com/google/androidenv/catch/sprite:Ball",
        "//java/com/google/androidenv/catch/sprite:Paddle",
        "@maven//:androidx_test_ext_junit",
        "@maven//:androidx_test_runner",
        "@maven//:com_google_truth_truth",
        "@maven//:org_mockito_kotlin_mockito_kotlin",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)

kt_android_local_test(
    name = "GameLogicThreadTest",
    srcs = ["GameLogicThreadTest.kt"],
    kotlinc_opts = ":kt_kotlinc_options",
    deps = [
        "//java/com/google/androidenv/catch:GameLogic",
        "//java/com/google/androidenv/catch:GameLogicThread",
        "@maven//:androidx_test_ext_junit",
        "@maven//:com_google_truth_truth",
        "@maven//:org_mockito_kotlin_mockito_kotlin",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)

kt_android_local_test(
    name = "MainActivityTest",
    srcs = [
        "MainActivityTest.kt",
    ],
    kotlinc_opts = ":kt_kotlinc_options",
    manifest = "AndroidManifest.xml",
    deps = [
        "//java/com/google/androidenv/catch:MainActivity",
        "@maven//:androidx_test_ext_junit",
        "@maven//:junit_junit",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)

kt_android_local_test(
    name = "RenderThreadTest",
    srcs = ["RenderThreadTest.kt"],
    kotlinc_opts = ":kt_kotlinc_options",
    deps = [
        "//java/com/google/androidenv/catch:GameLogic",
        "//java/com/google/androidenv/catch:RenderThread",
        "@maven//:androidx_test_ext_junit",
        "@maven//:org_mockito_kotlin_mockito_kotlin",
        "@maven//:org_mockito_mockito_core",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)
